package ReadWriteXML;

import java.util.ArrayList;

public class CMember {
	private String _ip;
	private String _fullName;
	private String _userName;
	
	public CMember()
	{
		_ip = null;
		_fullName = null;
		_userName = null;
	}
	
	public CMember(String ip, String fullName, String userName)
	{
		_ip = ip;
		_fullName = fullName;
		_userName = userName;
	}
	public String toParse(){
		return this._ip+";"+this._fullName+";"+this._userName;
	}
	public static CMember parse(String s){
		CMember member=new CMember();
		String []m=s.split(";");
		member.set_ip(m[0]);
		member.set_fullName(m[1]);
		member.set_userName(m[2]);
		return member;
	}
	public static String toParseList(ArrayList<CMember> memberList){
		String s="";
		for(CMember member:memberList){
			s+=member.toParse()+"#";
		}
		return s;			
	}
	public static ArrayList<CMember> parseList(String s){
		ArrayList<CMember> rs=new ArrayList<CMember>();
		String []m=s.split("#");
		for(int i=0;i<m.length;i++){
			rs.add(CMember.parse(m[i]));
		}
		return rs;
	}
	@Override
	public String toString(){
		return this._fullName;
	}
	public void set_ip(String _ip) {
		this._ip = _ip;
	}
	public String get_ip() {
		return _ip;
	}
	public void set_fullName(String _fullName) {
		this._fullName = _fullName;
	}
	public String get_fullName() {
		return _fullName;
	}
	
	public void set_userName(String _userName) {
		this._userName = _userName;
	}
	public String get_userName() {
		return _userName;
	}
	
}
